//
//  myView.m
//  UI_随便相册
//
//  Created by dllo on 16/4/9.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "myView.h"

@implementation myView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)dealloc{
    
    [_myImageView release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self doSomeThing];
    }
    
    return  self;
}

-(void)doSomeThing{
    
    self.myImageView = [[UIImageView alloc]init];
    self.myImageView.frame = CGRectMake(5, 10, self.frame.size.width - 10, self.frame.size.height - 50);
    [self addSubview:self.myImageView];
    [_myImageView release];
    self.myImageView.userInteractionEnabled = YES;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
    [self.myImageView addGestureRecognizer:tap];
    [tap release];
    tap.numberOfTapsRequired = 2;
    
}


-(void)tapAction:(UITapGestureRecognizer *)isTap{
    
    [self.myDelegate viewTocontroller:self.myImageView.tag];
}





@end
